load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

package_group(
    name = "ddl_friend",
    packages = [
        "-//pkg/planner/...",
        "//...",
    ],
)

go_library(
    name = "ddl",
    srcs = [
        "add_column.go",
        "backfilling.go",
        "backfilling_clean_s3.go",
        "backfilling_dist_executor.go",
        "backfilling_dist_scheduler.go",
        "backfilling_import_cloud.go",
        "backfilling_merge_sort.go",
        "backfilling_merge_temp.go",
        "backfilling_operators.go",
        "backfilling_read_index.go",
        "backfilling_txn_executor.go",
        "bdr.go",
        "cluster.go",
        "column.go",
        "constant.go",
        "constraint.go",
        "create_table.go",
        "ddl.go",
        "ddl_algorithm.go",
        "ddl_history.go",
        "ddl_running_jobs.go",
        "ddl_tiflash_api.go",
        "ddl_workerpool.go",
        "delete_range.go",
        "delete_range_util.go",
        "dist_owner.go",
        "doc.go",
        "executor.go",
        "foreign_key.go",
        "generated_column.go",
        "index.go",
        "index_cop.go",
        "index_merge_tmp.go",
        "index_presplit.go",
        "job_scheduler.go",
        "job_submitter.go",
        "job_worker.go",
        "metabuild.go",
        "mock.go",
        "modify_column.go",
        "multi_schema_change.go",
        "options.go",
        "owner_mgr.go",
        "partition.go",
        "placement_policy.go",
        "reorg.go",
        "reorg_util.go",
        "resource_group.go",
        "rollingback.go",
        "sanity_check.go",
        "schema.go",
        "schema_version.go",
        "sequence.go",
        "split_region.go",
        "stat.go",
        "table.go",
        "table_lock.go",
        "table_mode.go",
        "ttl.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/ddl",
    visibility = [
        ":ddl_friend",
    ],
    deps = [
        "//br/pkg/storage",
        "//br/pkg/storage/recording",
        "//pkg/config",
        "//pkg/config/kerneltype",
        "//pkg/ddl/copr",
        "//pkg/ddl/ingest",
        "//pkg/ddl/label",
        "//pkg/ddl/logutil",
        "//pkg/ddl/notifier",
        "//pkg/ddl/placement",
        "//pkg/ddl/resourcegroup",
        "//pkg/ddl/schemaver",
        "//pkg/ddl/serverstate",
        "//pkg/ddl/session",
        "//pkg/ddl/systable",
        "//pkg/ddl/testargsv1",
        "//pkg/ddl/util",
        "//pkg/distsql",
        "//pkg/distsql/context",
        "//pkg/disttask/framework/dxfmetric",
        "//pkg/disttask/framework/handle",
        "//pkg/disttask/framework/metering",
        "//pkg/disttask/framework/proto",
        "//pkg/disttask/framework/scheduler",
        "//pkg/disttask/framework/storage",
        "//pkg/disttask/framework/taskexecutor",
        "//pkg/disttask/framework/taskexecutor/execute",
        "//pkg/disttask/operator",
        "//pkg/domain/infosync",
        "//pkg/errctx",
        "//pkg/expression",
        "//pkg/expression/exprctx",
        "//pkg/expression/exprstatic",
        "//pkg/infoschema",
        "//pkg/infoschema/context",
        "//pkg/ingestor/engineapi",
        "//pkg/keyspace",
        "//pkg/kv",
        "//pkg/lightning/backend",
        "//pkg/lightning/backend/external",
        "//pkg/lightning/backend/local",
        "//pkg/lightning/common",
        "//pkg/lightning/config",
        "//pkg/lightning/metric",
        "//pkg/meta",
        "//pkg/meta/autoid",
        "//pkg/meta/metabuild",
        "//pkg/meta/metadef",
        "//pkg/meta/model",
        "//pkg/metrics",
        "//pkg/owner",
        "//pkg/parser",
        "//pkg/parser/ast",
        "//pkg/parser/charset",
        "//pkg/parser/format",
        "//pkg/parser/mysql",
        "//pkg/parser/opcode",
        "//pkg/parser/terror",
        "//pkg/parser/types",
        "//pkg/privilege",
        "//pkg/resourcegroup",
        "//pkg/resourcemanager/pool/workerpool",
        "//pkg/resourcemanager/util",
        "//pkg/sessionctx",
        "//pkg/sessionctx/stmtctx",
        "//pkg/sessionctx/vardef",
        "//pkg/sessionctx/variable",
        "//pkg/sessiontxn",
        "//pkg/statistics",
        "//pkg/statistics/handle",
        "//pkg/statistics/handle/util",
        "//pkg/store",
        "//pkg/store/driver/txn",
        "//pkg/store/helper",
        "//pkg/table",
        "//pkg/table/tables",
        "//pkg/table/tblctx",
        "//pkg/tablecodec",
        "//pkg/ttl/cache",
        "//pkg/types",
        "//pkg/types/parser_driver",
        "//pkg/util",
        "//pkg/util/backoff",
        "//pkg/util/chunk",
        "//pkg/util/codec",
        "//pkg/util/collate",
        "//pkg/util/context",
        "//pkg/util/dbterror",
        "//pkg/util/dbterror/exeerrors",
        "//pkg/util/dbterror/plannererrors",
        "//pkg/util/dbutil",
        "//pkg/util/domainutil",
        "//pkg/util/engine",
        "//pkg/util/etcd",
        "//pkg/util/execdetails",
        "//pkg/util/filter",
        "//pkg/util/gcutil",
        "//pkg/util/generatedexpr",
        "//pkg/util/generic",
        "//pkg/util/hack",
        "//pkg/util/intest",
        "//pkg/util/logutil",
        "//pkg/util/mathutil",
        "//pkg/util/memory",
        "//pkg/util/ppcpuusage",
        "//pkg/util/ranger",
        "//pkg/util/rowDecoder",
        "//pkg/util/rowcodec",
        "//pkg/util/set",
        "//pkg/util/size",
        "//pkg/util/slice",
        "//pkg/util/sqlexec",
        "//pkg/util/sqlkiller",
        "//pkg/util/stringutil",
        "//pkg/util/tiflash",
        "//pkg/util/timeutil",
        "//pkg/util/topsql",
        "//pkg/util/topsql/state",
        "//pkg/util/traceevent",
        "//pkg/util/tracing",
        "@com_github_coreos_go_semver//semver",
        "@com_github_docker_go_units//:go-units",
        "@com_github_google_uuid//:uuid",
        "@com_github_ngaut_pools//:pools",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/errorpb",
        "@com_github_pingcap_kvproto//pkg/kvrpcpb",
        "@com_github_pingcap_kvproto//pkg/metapb",
        "@com_github_pingcap_tipb//go-tipb",
        "@com_github_prometheus_client_golang//prometheus",
        "@com_github_tikv_client_go_v2//error",
        "@com_github_tikv_client_go_v2//kv",
        "@com_github_tikv_client_go_v2//oracle",
        "@com_github_tikv_client_go_v2//tikv",
        "@com_github_tikv_client_go_v2//tikvrpc",
        "@com_github_tikv_client_go_v2//txnkv/rangetask",
        "@com_github_tikv_client_go_v2//util",
        "@com_github_tikv_pd_client//clients/router",
        "@com_github_tikv_pd_client//http",
        "@com_github_tikv_pd_client//opt",
        "@io_etcd_go_etcd_client_v3//:client",
        "@org_golang_x_sync//errgroup",
        "@org_uber_go_atomic//:atomic",
        "@org_uber_go_zap//:zap",
        "@org_uber_go_zap//zapcore",
    ],
)

go_test(
    name = "ddl_test",
    timeout = "moderate",
    srcs = [
        "attributes_sql_test.go",
        "backfilling_dist_scheduler_test.go",
        "backfilling_test.go",
        "bdr_test.go",
        "bench_test.go",
        "cancel_test.go",
        "cluster_test.go",
        "column_change_test.go",
        "column_modify_test.go",
        "column_test.go",
        "column_type_change_test.go",
        "constraint_test.go",
        "db_cache_test.go",
        "db_change_failpoints_test.go",
        "db_change_test.go",
        "db_integration_test.go",
        "db_rename_test.go",
        "db_table_test.go",
        "db_test.go",
        "ddl_algorithm_test.go",
        "ddl_error_test.go",
        "ddl_history_test.go",
        "ddl_running_jobs_test.go",
        "ddl_test.go",
        "ddl_workerpool_test.go",
        "executor_nokit_test.go",
        "executor_test.go",
        "export_test.go",
        "fail_test.go",
        "foreign_key_test.go",
        "index_change_test.go",
        "index_cop_test.go",
        "index_modify_test.go",
        "index_nokit_test.go",
        "integration_test.go",
        "job_scheduler_test.go",
        "job_scheduler_testkit_test.go",
        "job_submitter_test.go",
        "job_worker_test.go",
        "main_test.go",
        "metabuild_test.go",
        "modify_column_test.go",
        "multi_schema_change_test.go",
        "mv_index_test.go",
        "options_test.go",
        "owner_mgr_test.go",
        "partition_test.go",
        "placement_policy_ddl_test.go",
        "placement_policy_test.go",
        "placement_sql_test.go",
        "primary_key_handle_test.go",
        "repair_table_test.go",
        "restart_test.go",
        "rollingback_test.go",
        "schema_test.go",
        "schema_version_test.go",
        "sequence_test.go",
        "stat_test.go",
        "table_mode_test.go",
        "table_modify_test.go",
        "table_split_test.go",
        "table_test.go",
        "tiflash_replica_test.go",
        "ttl_test.go",
    ],
    embed = [":ddl"],
    flaky = True,
    shard_count = 50,
    deps = [
        "//pkg/autoid_service",
        "//pkg/config",
        "//pkg/config/kerneltype",
        "//pkg/ddl/copr",
        "//pkg/ddl/ingest",
        "//pkg/ddl/ingest/testutil",
        "//pkg/ddl/logutil",
        "//pkg/ddl/mock",
        "//pkg/ddl/placement",
        "//pkg/ddl/schematracker",
        "//pkg/ddl/schemaver",
        "//pkg/ddl/serverstate",
        "//pkg/ddl/session",
        "//pkg/ddl/systable",
        "//pkg/ddl/testargsv1",
        "//pkg/ddl/testutil",
        "//pkg/ddl/util",
        "//pkg/distsql/context",
        "//pkg/disttask/framework/mock",
        "//pkg/disttask/framework/proto",
        "//pkg/disttask/framework/scheduler",
        "//pkg/disttask/framework/storage",
        "//pkg/disttask/framework/taskexecutor/execute",
        "//pkg/disttask/operator",
        "//pkg/domain",
        "//pkg/domain/infosync",
        "//pkg/domain/serverinfo",
        "//pkg/errctx",
        "//pkg/errno",
        "//pkg/executor",
        "//pkg/expression",
        "//pkg/expression/exprstatic",
        "//pkg/infoschema",
        "//pkg/infoschema/validatorapi",
        "//pkg/keyspace",
        "//pkg/kv",
        "//pkg/lightning/backend/external",
        "//pkg/meta",
        "//pkg/meta/autoid",
        "//pkg/meta/metabuild",
        "//pkg/meta/metadef",
        "//pkg/meta/model",
        "//pkg/parser",
        "//pkg/parser/ast",
        "//pkg/parser/auth",
        "//pkg/parser/charset",
        "//pkg/parser/mysql",
        "//pkg/parser/terror",
        "//pkg/parser/types",
        "//pkg/resourcemanager/pool/workerpool",
        "//pkg/server",
        "//pkg/session",
        "//pkg/session/sessionapi",
        "//pkg/session/sessmgr",
        "//pkg/sessionctx",
        "//pkg/sessionctx/vardef",
        "//pkg/sessionctx/variable",
        "//pkg/sessiontxn",
        "//pkg/store/gcworker",
        "//pkg/store/helper",
        "//pkg/store/mockstore",
        "//pkg/table",
        "//pkg/table/tables",
        "//pkg/tablecodec",
        "//pkg/testkit",
        "//pkg/testkit/external",
        "//pkg/testkit/testfailpoint",
        "//pkg/testkit/testsetup",
        "//pkg/testkit/testutil",
        "//pkg/types",
        "//pkg/util",
        "//pkg/util/chunk",
        "//pkg/util/codec",
        "//pkg/util/collate",
        "//pkg/util/context",
        "//pkg/util/dbterror",
        "//pkg/util/dbterror/plannererrors",
        "//pkg/util/deeptest",
        "//pkg/util/domainutil",
        "//pkg/util/gcutil",
        "//pkg/util/generic",
        "//pkg/util/mathutil",
        "//pkg/util/mock",
        "//pkg/util/sem/compat",
        "//pkg/util/sqlexec",
        "//pkg/util/timeutil",
        "@com_github_fsouza_fake_gcs_server//fakestorage",
        "@com_github_ngaut_pools//:pools",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/keyspacepb",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//oracle",
        "@com_github_tikv_client_go_v2//testutils",
        "@com_github_tikv_client_go_v2//tikv",
        "@com_github_tikv_client_go_v2//util",
        "@com_github_tikv_pd_client//http",
        "@io_etcd_go_etcd_client_v3//:client",
        "@org_golang_google_grpc//:grpc",
        "@org_golang_x_sync//errgroup",
        "@org_uber_go_atomic//:atomic",
        "@org_uber_go_goleak//:goleak",
        "@org_uber_go_mock//gomock",
        "@org_uber_go_zap//:zap",
    ],
)
